Skip to content

Load the API user after sign-in so an admin is recognised at once - #2260

Merged
umputun merged 2 commits into
umputun:masterfrom
pkvach:fix-admin-flag-after-signin
Oct 11, 2026
Merged

umputun merged 2 commits into
umputun:masterfrom
pkvach:fix-admin-flag-after-signin

Conversation

@pkvach

@pkvach pkvach commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #2205

Sign-in endpoints answer with the auth library's user, which keeps the admin flag under attrs. The widget stored that user as-is, so it treated an admin as a regular user until the next page load. The edit countdown on an admin's freshly posted comment came from that.

  • Anonymous, email and Telegram sign-in now fetch /user once the endpoint succeeds and return that user. The fetch skips the /auth/status probe that getUser makes first, because that probe tells nothing new right after a successful sign-in.
  • OAuth is unchanged: it already loads the user through getUser after the popup closes.

Sign-in endpoints answer with the auth library's user, which keeps the
admin flag under attrs. The widget therefore treated an admin as a
regular user until the next page load. The countdown on an admin's
freshly posted comment came from that. Anonymous, email and Telegram
sign-in now fetch /user after the endpoint succeeds.

Fixes umputun#2205
@pkvach
pkvach requested a review from umputun as a code owner October 5, 2026 21:06
@codecov

codecov Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.19%. Comparing base (505364b) to head (1c85bbe).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2260      +/-   ##
==========================================
+ Coverage   75.00%   75.19%   +0.18%     
==========================================
  Files         129      129              
  Lines        3757     3761       +4     
  Branches      869      833      -36     
==========================================
+ Hits         2818     2828      +10     
+ Misses        933      927       -6     
  Partials        6        6              
Flag Coverage Δ
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

paskal
paskal previously approved these changes Oct 11, 2026
# Conflicts:
#	frontend/apps/remark42/app/components/auth/auth.api.spec.ts

@umputun umputun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@umputun
umputun merged commit 98e4681 into umputun:master Oct 11, 2026
13 checks passed
@umputun umputun added this to the v1.18.0 milestone Oct 11, 2026
@pkvach
pkvach deleted the fix-admin-flag-after-signin branch October 12, 2026 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An admin's own new comment shows an edit countdown while ADMIN_EDIT is enabled

3 participants